Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

six phase motor - inprogress #267

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

six phase motor - inprogress #267

wants to merge 4 commits into from

Conversation

ranil345
Copy link
Collaborator

Development of six phase machines - new feature

@ranil345 ranil345 requested review from bhk11 and XyDrKRulof February 19, 2025 10:14
@ranil345 ranil345 requested a review from max-schenke February 26, 2025 15:16
@ranil345
Copy link
Collaborator Author

sixphasePMSM_ode (1).pdf
These are the set of equation i have used for the ode, please let me know in case of anything incorrect

Copy link
Member

@max-schenke max-schenke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes a good first impression!
Please reorder the ODE to make it more easily comprehensible.
I guess we would need to decide which level of generality we / you would like to cover with this model.

I_SY_IDX = 3
CURRENTS_IDX = [0, 1, 2, 3]
CURRENTS = ["i_sd", "i_sq", "i_sx", "i_sy"]
VOLTAGES = ["u_sd", "u_sq", "u_sx", "u_sx"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: last voltage component should be u_sy

Comment on lines 141 to 153
state[self.I_SD_IDX],
omega * state[self.I_SQ_IDX],
u_dqxy[0],
state[self.I_SQ_IDX],
omega * state[self.I_SD_IDX],
omega,
u_dqxy[1],
state[self.I_SX_IDX],
omega * state[self.I_SY_IDX],
u_dqxy[2],
state[self.I_SY_IDX],
omega * state[self.I_SX_IDX],
u_dqxy[3]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Order of these regressors is rather unsorted. Please implement the same ordering as in other motors, i.e. group the current components, the voltage components and the current * omega components.
The same reordering must then be applied to the parameter matrix (self._model_constants).

Called internally when the motor parameters are changed or the motor is initialized.
"""
mp = self._motor_parameter
self._model_constants = np.array([
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be helpful to specify via comment which matrix column belongs to which regressor (please see other motor types for reference).

Comment on lines 47 to 57
Returns:
The converted quantities in the dq representation like ''[i_sd, i_sq, i_sx, i_sy, i_s0+, i_s0-]''.
since 2N topology is considered (case where the neutral points are not connected) i_s0+, i_s0- will not be taken into account
"""
t_vsd = 1/ 3 * np.array([
[1, -0.5, -0.5, 0.5 * np.sqrt(3), -0.5 * np.sqrt(3), 0],
[0, 0.5 * np.sqrt(3), -0.5 * np.sqrt(3), 0.5, 0.5, -1],
[1, -0.5, -0.5, -0.5 * np.sqrt(3), 0.5 * np.sqrt(3), 0],
[0, -0.5 * np.sqrt(3), 0.5 * np.sqrt(3), 0.5, 0.5, -1],
[1, 1, 1, 0, 0, 0],
[0, 0, 0, 1, 1, 1]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me this seems inconsistent: the function doc says that i_s0 components will not be considered, but the subsequent matrix computation does still compute them / contains the corresponding lines. I think it should be possible to:

  1. either get rid of these lines if the definition is to only hold for the 2N topology,
    OR
  2. cover the general case, whereas it might as well be desired to simulate a 1N topology.

Comment on lines +61 to +68
tp_alphaBetaXY = np.array([
[cos, sin, 0, 0, 0, 0],
[-sin, cos, 0, 0, 0, 0],
[0, 0, cos, sin, 0, 0],
[0, 0, -sin, cos, 0, 0],
[0, 0, 0, 0, 1, 0]
[0, 0, 0, 0, 0, 1]
])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first diagonal block entry has a positive sense of rotation, but the second one should have a negative. (As of now, both are coded the same).
For easier comprehension, I would suggest to define the 2D rotation matrix first as a function T(epsilon), and then compound this 6D rotation matrix from blkdiag[T(epsilon), T(-epsilon), eye(2)].

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sense of rotation is still documented in the wrong way here

Copy link
Member

@max-schenke max-schenke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for your invested time, this is looking very nice already. There are only a few miscellaneous comments I would like you to consider.

u_sd V Direct axis voltage
u_sq V Quadrature axis voltage
u_sx V
u_sx V
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u_sy

Comment on lines +120 to +123
[ 0, -mp['r_s'], 0, 0, 0, 1, 0, 0, 0, 0, mp['l_q'], 0, 0],
[-mp['psi_PM'], 0, -mp['r_s'], 0, 0, 0, 1, 0, 0, -mp['l_d'], 0, 0, 0],
[ 0, 0, 0, -mp['r_s'], 0, 0, 0, 1, 0, 0, 0, 0, -mp['l_y']],
[ 0, 0, 0, 0, -mp['r_s'], 0, 0, 0, 1, 0, 0, mp['l_x'], 0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good to me. Good job!

Comment on lines +61 to +68
tp_alphaBetaXY = np.array([
[cos, sin, 0, 0, 0, 0],
[-sin, cos, 0, 0, 0, 0],
[0, 0, cos, sin, 0, 0],
[0, 0, -sin, cos, 0, 0],
[0, 0, 0, 0, 1, 0]
[0, 0, 0, 0, 0, 1]
])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sense of rotation is still documented in the wrong way here

Comment on lines +82 to +87
t1 = rotation_matrix(epsilon)
t2 = rotation_matrix(-epsilon)
tp_alphaBetaXY = np.block([
[t1, np.zeros(t1.shape[0],t1.shape[1])],
[np.zeros(t2.shape[0],t2.shape[1]), t2],
])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scipy provides a command that should make this snippet more clear

https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.block_diag.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants